import { useRoutes } from "react-router-dom";
import { routes } from "./router";
import eventBus from "./utils/eventBus";
import { useNavigate } from "react-router-dom";
import { useEffect, useRef } from "react";
import { TransitionGroup, CSSTransition } from "react-transition-group";
import "./App.css";
import "antd/dist/reset.css"; // 引入样式
function Routes() {
  return useRoutes(routes);
}

export default function App() {
  const navigate = useNavigate();
  const nodeRef = useRef(null); // 添加 ref
  useEffect(() => {
    eventBus.on("app_unauthorized", () => {
      navigate("/login");
    });
  }, [navigate]);
  return (
    <Routes />
  );
}
